<HTML>
<HEAD>
	<TITLE>Notes for PHP Form kit</TITLE>
	<style type="text/css">
        body {
	        font-family: Arial, Helvetica, sans-serif;
	        font-size: 12px;
	        color:  #666666;
        }
        a:link, a:visited {
            color:  #666666;
        }
        h2 {  
            color:#007F64;
	        font-weight: bold;
	        font-size:22px;
	        padding-bottom: 14px;
        }
        h3
        {   background-image: url(images/yellowBlob.png);
            background-repeat: no-repeat;
            background-position: 0px 22px;
            padding: 20px 0px 8px 30px;
	        font-size: 18px;
	        color: #E98300;
        }
        p {
           padding-left: 24px;
        }
        ul {
           margin-left: 36px;
        }
        #pageHeader {
            padding: 20px 20px 20px 20px;
            height: 40px;
        }
	</style>
</HEAD>
<BODY>
<div id="pageHeader">
    <img src="images/sage_pay_logo.gif" style="float:left;" />
    <img src="images/title.png" style="float:right;" />
</div>
<h2>Notes for Form PHP Integration kit</h2>

<UL>
	<LI><A HREF="#1">REQUIREMENTS</A>
	<LI><A HREF="#2">SETTING UP THE KIT</A>
	<LI><A HREF="#3">TESTING THE KIT</A>
	<LI><a href="#4">MODIFYING THE KIT</a>
    <LI><A HREF="#6">RELATED DOCUMENTATION</A>	
</UL>
<h3><A NAME="1">NOTE</a></h3>
<UL>
	<li>Please note that this kit was developed and tested on a Windows platform. The kit can however be installed on a Linux platform. 	For Windows users, it is assumed that you have installed, and are familiar with, Microsoft Internet Information Services version 6.0. For Linux users, it is assumed you have installed, and are familiar with, Apache HTTP Server 2.0 and higher.
	<br/><br/>
</UL>
<H3><A NAME="1">REQUIREMENTS</A></H3>

<UL>
  <LI><B>PHP</B><BR>
	Your web Form must have the ability to run PHP 5.0 or higher. <br><br/>
	<LI><B>Mcrypt</B><br/>
	This kit uses Mcrypt to encrypt information posted to the Sage Pay Gateway. Mcrypt is free open source software and comes with the installation for PHP 5.0 (and above). For Mcrypt downloads and installation instructions please visit <a href="http://www.php.net/mcrypt" target="_blank">www.php.net/mcrypt</a>
</UL>

<H3><A NAME="2">SETTING UP THE KIT</A></H3>

<p>Please note that this kit was developed and tested on a Windows platform. The kit can however be installed on a Linux platform. 
For Windows users, it is assumed that you have installed, and are familiar with, Microsoft Internet Information Services version 6.0. 
For Linux users, it is assumed you have installed, and are familiar with, Apache HTTP Server 2.0 and higher. 
<ul>
  <li>The kit will unzip to a folder called SagePayFormKit. You can run this from anywhere, but we recommend keeping the paths simple by installing it on the root of your data drive for Windows (e.g. C:\SagePayFormKit or D:\SagePayFormKit), or in the root folder specified in the httpd.conf file if running Apache.<br>
    <br>
  </li>
  <b>Windows XP and 2003 users</b><br/>
  <li>Ensure that the user under which the web Form is running has READ and EXECUTE permissions to the folder in which the kit is installed. Grant those permissions using Windows Explorer. <br>
    <br>  
  </li>
  <li>	Now create a virtual directory in your local IIS to point to the kit. <br>
  <ul>
    <li>Open Administrative Tools-&gt;Internet Information Services. </li>
    <li> Drill down into the Web Sites folder to find your Default Web Site.</li>
    <li> Right click it and select New-&gt;Virtual Directory</li>
    <li> Click Next in the dialog.</li>
    <li> Enter the Alias <em>SagePayFormKit</em> and click Next.</li>
    <li> Browse to c:\SagePayFormKit (or wherever you installed the kit).  Click OK.</li>
    <li> Click Next</li>
    <li> Ensure Read, Run and Execute are selected, then click Next.<br>
    </li>
    <li>Click Finish.  The list of pages should appear in the right hand column.<br>
    </li>
    <li>Right click and go to Properties, select the Documents tab and remove all pages. </li>
    <li>Then click Add and enter welcome.php. </li>
    <li>Click OK </li>
    <li>Then close the properties dialog with OK.<br><br></li>
	</ul>
   	<b>Windows Vista Users</b>
	<ul>
    <li> Open Administrative Tools-&gt;Internet Information Services (IIS) Manager<br>
      </li>
    <li>	Drill down into the Web Sites folder to find Default Web Site.<br>
      </li>
    <li>	Right click it and select Add Virtual Directory<br>
      </li>
    <li>	Enter the Alias <em>SagePayFormKit</em> and the in the Path, browse to c:\SagePayFormKit (or wherever you installed the kit). Click OK<br>
      </li>
    <li>	Select the SagePayFormKit directory and in Features View, double click Default Document.<br>
      </li>
    <li>	Delete all entries and enter welcome.php . Click Apply in the right hand column.<br>
      <br>
    </li>
	</ul>
	<b>Linux Users</b>
	<ul>
	<li>Set up a virtual host in Apache where you will run the kit from. To do this, open the httpd.conf file in an editor. At the very bottom of this file is a  Virtual Hosts section.
	<li>Add a new virtual host in accordance with your local set-up. For example if you were creating a directory called SagePayFormKit on php:<br/>
	&lt;VirtualHost 127.0.0.1&gt;<br/>
    ServerName SagePayFormKit<br/>
    DocumentRoot /www/htdocs/SagePayFormKit<br/>
    &lt;/VirtualHost&gt;<br/>
	<li>Also in the httpd.conf file, add welcome.php as a default document in the &lt;IfModule mod_dir.c&gt section. For example:<br>
	&lt;IfModule mod_dir.c&gt;<br/>
    DirectoryIndex index.htm index.html index.php default.html welcome.php<br/>
    &lt;/IfModule&gt;<br/>

	<li>Ensure that your root folder is accessible to the Apache program. This requires that the folder belongs to a non-privileged user.</ul><br/>
	
  </li>
  <li>	Open the includes.php file in your preferred web development system, or a plain text editor if you do not have one.<br/>
    <br>
  </li>
  <li>	At the top of the file is a section labelled &ldquo;Values for you to update&rdquo;<br>
    <br>
  </li>
  <li>	If you chose not to call your Virtual Directory or Alias <em>SagePayFormKit</em>, change the <em>$strVirtualDir</em> value to the name of the directory you chose.<br>
    <br>
  </li>
  <li>	Edit the <em>$strYourSiteFQDN</em> to point to the Fully Qualified DNS Name (FQDN) of your site.<br>
    <br>
    Your FQDN must start with http:// (or https:// if it is secured with an SSL certificate) plus the DNS name (e.g. www.sagepay.com).  <br>
    <br>
    If you do not have a DNS name, you can use your IP address, but it MUST be the externally facing IP address of your system i.e. an address on which the Sage Pay Form on the other side of you firewalls can call back to.  <br>
    <br>
  If in doubt, contact your network Administrator.<br>
  <br>
  NOTE: Do not add the Virtual Directory name to this address.  It is done automatically by the kit.<br>
  <br>
  </li>
  <li>	Set <em>$strVendorName</em> to your Sage Pay Vendor name, chosen when you set up your account through our online application form, or as issued to you by Sage Pay Technical Support if you did not complete the online form.<br>
    <br>
  </li>
  <li>Set the <em>$strEncryptionPassword</em> to the XOR Encryption password created for you when you set up your simulator account (which was subsequently sent to you in an e-mail), or the password assigned to you by the Sage Pay Support team when your test and/or live account was created. If you do not know your encryption password, e-mail Sage Pay Support to request it. <br>
    <br>
  </li>
  <li>	If the default currency through which you accept payments is not UK Sterling (GBP), then change the <em>$strCurrency</em> field to the correct 3-digit ISO currency code for your transactions e.g (EUR for Euro, USD for US Dollars). ONLY change this value if the merchant account from your acquiring bank supports that currency.<br>
      <br>
  </li>
  <li>Set the <em>$strVendorEMail</em> to the address to which you would like order confirmation and failure e-mails to be sent. Sage Pay Form will send a mail for each successful or unsuccessful order to that address, allowing you to be notified of transactions passing through your site. If you do not wish to receive these mails and prefer to check your transaction in My Sage Pay, leave this value as it is. <br>
    <br>
  </li>
  <li>If you are a Sage Pay Partner and wish to flag the transactions with your unique partner id then set <em>strPartnerID</em> to your unique partner id.<br>
    <br>
  </li>
  <li>Save the changes to the includes.php file.<br>
    <br>
  </li>
</ul>

 
<h3><A NAME="3">TESTING THE KIT</A></h3>
<ul>
  <li>Open a browser and go to http://localhost/SagePayFormKit<br>
	(append the port number you are using to 'localhost' if applicable)<br><br>
  </li>
  <li> You should see the welcome screen.  This will confirm that the virtual directory is set up correctly.  If it is not, you will see and error and will need to modify the settings in the includes.php file to correct the issue.<br>
    <br>
  </li>
  <li>The pages themselves contain descriptions of how they work, where the code is located, and how to proceed at each step. They will walk you through a complete payment process.<br>
    <br>
  </li>
  <li>When you have your site working with Simulator, and the Sage Pay Support team have set up a test account for you, you can change the <em>$strConnectTo</em> value in the includes files to TEST. This will point at the Test server and you'll see the true user experience (since this is identical to the Live systems, but without the banks attached). <br>
  </li>
</ul>
<P>
<H3><A NAME="4">MODIFYING THE KIT </A></H3>

<p>You are free to use and modify the kits as little or as much as you like. Sage Pay support will be able to advise you how to link your web site with Sage Pay Form, and hopefully the example code in this kit will simplify the process for you.  <br>
  <br>
  As you can appreciate, each web-site implementation is different, so whilst our support teams can help you with the standard, unmodified kit, we cannot support the pages after you've made changes to them.  We will, of course, advise as best we can and will do our best to help make the integration as uncomplicated as possible. <br>
  <br>
If you are not comfortable with coding your own website, or find the kits beyind your level of comfort, we can help by providing a list of integration partners with whom we work, who have a good knowledge of our system and can help with your integration. Please visit <a href="http://www.sagepay.com/partners.asp" target="_blank">http://www.sagepay.com/partners.asp</a> to search for a relevant partner. </p>
<H3><A NAME="6" id="6">RELATED DOCUMENTATION</A></H3>
<UL>
    <LI><a href="http://www.sagepay.com/documents/SagePayFormProtocolandIntegrationGuideline.pdf" target="_blank">Sage Pay Form Protocol and Integration Guideline</a><BR>	
	<LI><a href="http://www.sagepay.com/documents/sage_pay_acceptable_values_july09.pdf" target="_blank">Sage Pay Protocol Guide - Acceptable Values</a><BR>
    <LI><a href="http://www.sagepay.com/documents/MySagePayUserManual.pdf" target="_blank">My Sage Pay User Manual</a><BR>	
    <LI><a href="http://www.sagepay.com/documents/SagePayFraudPrevention.pdf" target="_blank">How to Prevent Fraud</a><BR>
</UL>
</BODY>
</HTML>
